package utils

import (
	"encoding/json"
	"errors"
)

func BindJson(body []byte, contentType string, obj any) (err error) {
	if contentType != "application/json" {
		return errors.New("contentType is not json")
	}
	err = json.Unmarshal(body, &obj)
	if err != nil {
		return
	}
	return
}
